package com.gdk.ksoft.ui.customers;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.gdk.ksoft.R;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

/**
 * 客户联系人维护
 */
public class ContactorActivity extends Activity {

    @ViewInject(R.id.pcontactor_etContactorName)private EditText etContactorName;//联系人名称
    @ViewInject(R.id.pcontactor_etContactorJob)private EditText etContactorJob;//联系人职务
    @ViewInject(R.id.pcontactor_etContactorPhone)private EditText etContactorPhone;//联系方式
    @ViewInject(R.id.pcontactor_txtCustomerName)private TextView txtCustomerName;//客户名称

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_contactor);
        ViewUtils.inject(this);
    }

    @OnClick(value={R.id.pcontactor_txtCancel,R.id.pcontactor_txtSubmit})
    public void onViewClick(View view){
        switch(view.getId()){
            case R.id.pcontactor_txtCancel://取消
                break;
            case R.id.pcontactor_txtSubmit://添加联系人
                break;
        }
    }

    /**
     * 页面返回
     */
    public void goBack() {
        this.finish();
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
    }

    @OnClick(value = {R.id.pcontactor_txtBack})
    public void OnBackClick(View view) {
        goBack();//页面返回
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_BACK) {
            goBack();//页面返回
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
